package com.rabbitmq.rabbitmqdemo.receiver;

import com.rabbitmq.rabbitmqdemo.config.RabbitConfig;
import com.rabbitmq.rabbitmqdemo.model.MyModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @Author: zhangQi
 * @Date: 2020-07-19 10:39
 */
@Component
@RabbitListener(queues = RabbitConfig.QUEUE_A)
public class MyReceiver {

    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @RabbitHandler
    public void process(MyModel model){
        logger.info("接收处理队列A当中的消息:"+model.getInfo());
    }
}
